import { getBaseUrl } from '@/services/urlconst';
import { requestFunComponFiex } from '@/utils';
import { useRequest } from 'umi';

const baseUrl = getBaseUrl();
// const baseUrl = '/wenchuang';

/** OA页面已读已办消息推送 */
export const setOAMessageSev = (cb: (res: Record<string, any>) => void) => {
  const request = useRequest(
    (payload) => {
      let bodyParams = {
        ...payload,
      };
      let reqUrl = `${baseUrl}/taskPushController/syncPushTask`;
      return requestFunComponFiex('PUT', reqUrl, bodyParams);
    },
    {
      manual: true,
      onSuccess: cb,
    },
  );

  return {
    setOAMessageRun: request?.run,
    setOAMessageLoaidng: request?.loading,
  };
};
